﻿using System.Globalization;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace EasyDDD.AdminModule.Host.WebAPI.Middleware
{
    public class PureAdminResponesMiddleware
    {
        private readonly RequestDelegate _next;

        public PureAdminResponesMiddleware(RequestDelegate next)
        {
            _next = next;
        }

        public async Task InvokeAsync(HttpContext context)
        {
            await _next(context);

            if (context.Response != null)
            {
                await context.Response.WriteAsJsonAsync(new PureAdminRespones()
                {
                    success = true,
                    //data = context.Response.Body.ReadByte
                });
            }
        }
    }

    public class PureAdminRespones
    {
        public bool success { get; set; }

        public object data { get; set; } = default!;

    }
}
